﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SysWebForm_Func : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            gv.DataBind();
        }
    }

    protected void btnAdd_Click(object sender, EventArgs e)
    {
    }

    protected void gv_ItemCommand(object sender, GridViewCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case "MyEdit":
                {
                    var row = (e.CommandSource as Control).NamingContainer as GridViewRow;

                    var db = new DB();
                    var dt = db.Execute("SELECT * FROM EmpData WHERE EmpID = @EmpID"
                                    , new DBParameter("EmpID", gv.DataKeys[row.RowIndex]["EmpID"]));

                    //mv.SetActiveView(mvForm);
                    //fv.ChangeMode(FormViewMode.Edit);
                    //fv.DataSource = dt;
                    //fv.DataBind();
                }

                break;
            case "MyDelete":
                {
                    var row = (e.CommandSource as Control).NamingContainer as GridViewRow;

                    //if (DelData(row) == true)
                    //{
                    //    gv.DataBind();
                    //}
                }

                break;
        }
    }

    protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gv.PageIndex = e.NewPageIndex;
        gv.DataBind();
    }
}